<template>
  <div class="column">
    <header-panda firstPath="/" firstTitle="返回">
      <router-link slot="todayPath" to='/' tag="div" key="1" class="home-nav-item swiper-slide" style="color: #877a73;">
        今日推荐
      </router-link>
    </header-panda>
    <div class="banner setPadTop">
      <img :src="cover" alt="cover">
    </div>
    <div class="cart-content" >
      <ul class="cart-list">
        <cart-item v-for="(item,index) in columnList" :key="item.commodityId + '-' + index"
        :img="item.image"
        :title="item.title"
        :price="item.price"
        :num="item.saleNum"
        :id="item.id"
        :weight="item.couponValue"
        :free-postage="item.isFreePostage"
        :platform="item.platform"
        ></cart-item>
      </ul>
    </div>
  </div>
</template>
<script>
import headerPanda from '@/components/Header'
import { mapState, mapActions } from 'vuex' // mapState 是vuex提供的切割函数，
import cartItem from '@/components/CartItem'
export default {
  created () {
    this.getColumnAction(this.$route.fullPath)
    this.getColumnList({ start: 0, path: this.$route.fullPath })
  },
  methods: {
    ...mapActions('columndata', ['getColumnAction', 'getColumnList'])
  },
  computed: {
    ...mapState('columndata', ['cover', 'columnList'])
  },
  components: {
    headerPanda,
    cartItem
  }
}
</script>

<style lang="scss" scoped>
.banner{
  img{
    width: 100%;
  }
}
</style>
